# 1.创建测试套件
import unittest

import app
from lib.HTMLTestRunner_PY3 import HTMLTestRunner
from script.test01_login import TestLogin
from script.test02_emp import TestEmp

suite = unittest.TestSuite()

# 2.在测试套件中添加测试类
suite.addTest(unittest.makeSuite(TestLogin))
suite.addTest(unittest.makeSuite(TestEmp))
suite.addTest(unittest.makeSuite(TestEmp))

# 3. 指定测试报告存放的位置
report_path = app.BASE_PATH + "/report/report.html"

# 将执行结果写入到测试报告中
with open(report_path, mode="wb") as f:
    # 4. 实例化HTMLTestRunner对象
    runner = HTMLTestRunner(f)
    # 5. 执行测试套件
    runner.run(suite)
